package com.zhijian.medical.service;


import com.zhijian.medical.entity.po.AssessmentPaperPerson;
import com.zhijian.medical.entity.vo.request.AssessmentPaperPersonSearchVo;
import com.zhijian.medical.entity.vo.response.AssessmentPaperPersonVo;
import com.zhijian.medical.util.Page;

import java.math.BigDecimal;
import java.util.List;

/**
 * 考核-试卷-人员关系表 业务处理层
 *
 * @author HCG
 * @version 1.0
 * @date 2023-02-02 14:45:42
 */
public interface AssessmentPaperPersonService {

    /**
     * 主键查询
     *
     * @param id
     * @return
     */
    AssessmentPaperPerson selectById(Long id);

    /**
     * 主键查询vo
     *
     * @param id
     * @return
     */
    AssessmentPaperPersonVo selectVoById(Long id);

    /**
     * 按照主键删除
     *
     * @param id
     */
    void deleteById(Long id);

    /**
     * 根据考核id进行删除
     *
     * @param assessmentId
     */
    void deleteByAssessmentId(Long assessmentId);

    /**
     * 新增
     *
     * @param assessmentPaperPerson
     * @return
     */
    Long insert(AssessmentPaperPerson assessmentPaperPerson);

    /**
     * 更改
     *
     * @param assessmentPaperPerson
     * @return
     */
    boolean update(AssessmentPaperPerson assessmentPaperPerson);

    /**
     * 动态修改
     *
     * @param record
     * @return
     */
    boolean updateByPrimaryKeySelective(AssessmentPaperPerson record);

    /**
     * 动态修改
     *
     * @param record
     * @return
     */
    boolean updateByUserIdAndAssessmentId(AssessmentPaperPerson record);

    /**
     * 总数
     *
     * @param assessmentPaperPersonSearchVo
     * @return
     */
    Integer count(AssessmentPaperPersonSearchVo assessmentPaperPersonSearchVo);

    /**
     * 列表
     *
     * @param assessmentPaperPersonSearchVo
     * @return
     */
    List<AssessmentPaperPersonVo> selectList(AssessmentPaperPersonSearchVo assessmentPaperPersonSearchVo);

    /**
     * 根据试卷id查找
     *
     * @param assessmentPaperId
     * @return
     */
    AssessmentPaperPersonVo selectByAssessmentPaperId(Long assessmentPaperId);

    /**
     * 根据考核ID与人ID查询
     *
     * @param assessmentId
     * @param personId
     * @return
     */
    AssessmentPaperPersonVo selectByAssessmentIdAndPersonId(Long assessmentId, Long personId);

    /**
     * 分页查询
     *
     * @param assessmentPaperPersonSearchVo
     * @return
     */
    Page<AssessmentPaperPersonVo> selectPage(AssessmentPaperPersonSearchVo assessmentPaperPersonSearchVo);

    /**
     * 批量新增数据（MyBatis原生foreach方法）
     *
     * @param entities 实例对象列表
     * @return 影响行数
     */
    boolean insertBatch(List<AssessmentPaperPerson> entities);

    /**
     * 查询某次考核的所有人的平均分
     *
     * @param assessmentId
     * @return
     */
    BigDecimal selectAvgScoreByAssessmentId(Long assessmentId);
}